

<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
  <meta charset="utf-8">
  
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta name="Description" content="scikit-learn: machine learning in Python">

  
  <title>sklearn.neural_network.MLPRegressor &mdash; scikit-learn 0.22 documentation</title>
  
  <link rel="canonical" href="http://scikit-learn.org/stable/modules/generated/sklearn.neural_network.MLPRegressor.html" />

  
  <link rel="shortcut icon" href="../../_static/favicon.ico"/>
  

  <link rel="stylesheet" href="../../_static/css/vendor/bootstrap.min.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/gallery.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/css/theme.css" type="text/css" />
<script id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script>
<script src="../../_static/jquery.js"></script> 
</head>
<body>
<nav id="navbar" class="sk-docs-navbar navbar navbar-expand-md navbar-light bg-light py-0">
  <div class="container-fluid sk-docs-container px-0">
      <a class="navbar-brand py-0" href="../../index.html">
        <img
          class="sk-brand-img"
          src="../../_static/scikit-learn-logo-small.png"
          alt="logo"/>
      </a>
    <button
      id="sk-navbar-toggler"
      class="navbar-toggler"
      type="button"
      data-toggle="collapse"
      data-target="#navbarSupportedContent"
      aria-controls="navbarSupportedContent"
      aria-expanded="false"
      aria-label="Toggle navigation"
    >
      <span class="navbar-toggler-icon"></span>
    </button>

    <div class="sk-navbar-collapse collapse navbar-collapse" id="navbarSupportedContent">
      <ul class="navbar-nav mr-auto">
        <li class="nav-item">
          <a class="sk-nav-link nav-link" href="../../install.html">Install</a>
        </li>
        <li class="nav-item">
          <a class="sk-nav-link nav-link" href="../../user_guide.html">User Guide</a>
        </li>
        <li class="nav-item">
          <a class="sk-nav-link nav-link" href="../classes.html">API</a>
        </li>
        <li class="nav-item">
          <a class="sk-nav-link nav-link" href="../../auto_examples/index.html">Examples</a>
        </li>
        <li class="nav-item">
          <a class="sk-nav-link nav-link nav-more-item-mobile-items" href="../../getting_started.html">Getting Started</a>
        </li>
        <li class="nav-item">
          <a class="sk-nav-link nav-link nav-more-item-mobile-items" href="../../tutorial/index.html">Tutorial</a>
        </li>
        <li class="nav-item">
          <a class="sk-nav-link nav-link nav-more-item-mobile-items" href="../../glossary.html">Glossary</a>
        </li>
        <li class="nav-item">
          <a class="sk-nav-link nav-link nav-more-item-mobile-items" href="../../developers/index.html">Development</a>
        </li>
        <li class="nav-item">
          <a class="sk-nav-link nav-link nav-more-item-mobile-items" href="../../faq.html">FAQ</a>
        </li>
        <li class="nav-item">
          <a class="sk-nav-link nav-link nav-more-item-mobile-items" href="../../related_projects.html">Related packages</a>
        </li>
        <li class="nav-item">
          <a class="sk-nav-link nav-link nav-more-item-mobile-items" href="../../roadmap.html">Roadmap</a>
        </li>
        <li class="nav-item">
          <a class="sk-nav-link nav-link nav-more-item-mobile-items" href="../../about.html">About us</a>
        </li>
        <li class="nav-item">
          <a class="sk-nav-link nav-link nav-more-item-mobile-items" href="https://github.com/scikit-learn/scikit-learn">GitHub</a>
        </li>
        <li class="nav-item">
          <a class="sk-nav-link nav-link nav-more-item-mobile-items" href="https://scikit-learn.org/dev/versions.html">Other Versions</a>
        </li>
        <li class="nav-item dropdown nav-more-item-dropdown">
          <a class="sk-nav-link nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">More</a>
          <div class="dropdown-menu" aria-labelledby="navbarDropdown">
              <a class="sk-nav-dropdown-item dropdown-item" href="../../getting_started.html">Getting Started</a>
              <a class="sk-nav-dropdown-item dropdown-item" href="../../tutorial/index.html">Tutorial</a>
              <a class="sk-nav-dropdown-item dropdown-item" href="../../glossary.html">Glossary</a>
              <a class="sk-nav-dropdown-item dropdown-item" href="../../developers/index.html">Development</a>
              <a class="sk-nav-dropdown-item dropdown-item" href="../../faq.html">FAQ</a>
              <a class="sk-nav-dropdown-item dropdown-item" href="../../related_projects.html">Related packages</a>
              <a class="sk-nav-dropdown-item dropdown-item" href="../../roadmap.html">Roadmap</a>
              <a class="sk-nav-dropdown-item dropdown-item" href="../../about.html">About us</a>
              <a class="sk-nav-dropdown-item dropdown-item" href="https://github.com/scikit-learn/scikit-learn">GitHub</a>
              <a class="sk-nav-dropdown-item dropdown-item" href="https://scikit-learn.org/dev/versions.html">Other Versions</a>
          </div>
        </li>
      </ul>
      <div id="searchbox" role="search">
          <div class="searchformwrapper">
          <form class="search" action="../../search.html" method="get">
            <input class="sk-search-text-input" type="text" name="q" aria-labelledby="searchlabel" />
            <input class="sk-search-text-btn" type="submit" value="Go" />
          </form>
          </div>
      </div>
    </div>
  </div>
</nav>
<div class="d-flex" id="sk-doc-wrapper">
    <input type="checkbox" name="sk-toggle-checkbox" id="sk-toggle-checkbox">
    <label id="sk-sidemenu-toggle" class="sk-btn-toggle-toc btn sk-btn-primary" for="sk-toggle-checkbox">Toggle Menu</label>
    <div id="sk-sidebar-wrapper" class="border-right">
      <div class="sk-sidebar-toc-wrapper">
        <div class="sk-sidebar-toc-logo">
          <a href="../../index.html">
            <img
              class="sk-brand-img"
              src="../../_static/scikit-learn-logo-small.png"
              alt="logo"/>
          </a>
        </div>
        <div class="btn-group w-100 mb-2" role="group" aria-label="rellinks">
            <a href="sklearn.neural_network.MLPClassifier.html" role="button" class="btn sk-btn-rellink py-1" sk-rellink-tooltip="sklearn.neural_network.MLPClassifier">Prev</a><a href="../classes.html" role="button" class="btn sk-btn-rellink py-1" sk-rellink-tooltip="API Reference">Up</a>
            <a href="sklearn.pipeline.FeatureUnion.html" role="button" class="btn sk-btn-rellink py-1" sk-rellink-tooltip="sklearn.pipeline.FeatureUnion">Next</a>
        </div>
        <div class="alert alert-danger p-1 mb-2" role="alert">
          <p class="text-center mb-0">
          <strong>scikit-learn 0.22</strong><br/>
          <a href="http://scikit-learn.org/dev/versions.html">Other versions</a>
          </p>
        </div>
        <div class="alert alert-warning p-1 mb-2" role="alert">
          <p class="text-center mb-0">
            Please <a class="font-weight-bold" href="../../about.html#citing-scikit-learn"><string>cite us</string></a> if you use the software.
          </p>
        </div>
          <div class="sk-sidebar-toc">
            <ul>
<li><a class="reference internal" href="#"><code class="xref py py-mod docutils literal notranslate"><span class="pre">sklearn.neural_network</span></code>.MLPRegressor</a><ul>
<li><a class="reference internal" href="#examples-using-sklearn-neural-network-mlpregressor">Examples using <code class="docutils literal notranslate"><span class="pre">sklearn.neural_network.MLPRegressor</span></code></a></li>
</ul>
</li>
</ul>

          </div>
      </div>
    </div>
    <div id="sk-page-content-wrapper">
      <div class="sk-page-content container-fluid body px-md-3" role="main">
        
  <div class="section" id="sklearn-neural-network-mlpregressor">
<h1><a class="reference internal" href="../classes.html#module-sklearn.neural_network" title="sklearn.neural_network"><code class="xref py py-mod docutils literal notranslate"><span class="pre">sklearn.neural_network</span></code></a>.MLPRegressor<a class="headerlink" href="#sklearn-neural-network-mlpregressor" title="Permalink to this headline">¶</a></h1>
<dl class="class">
<dt id="sklearn.neural_network.MLPRegressor">
<em class="property">class </em><code class="sig-prename descclassname">sklearn.neural_network.</code><code class="sig-name descname">MLPRegressor</code><span class="sig-paren">(</span><em class="sig-param">hidden_layer_sizes=(100</em>, <em class="sig-param">)</em>, <em class="sig-param">activation='relu'</em>, <em class="sig-param">solver='adam'</em>, <em class="sig-param">alpha=0.0001</em>, <em class="sig-param">batch_size='auto'</em>, <em class="sig-param">learning_rate='constant'</em>, <em class="sig-param">learning_rate_init=0.001</em>, <em class="sig-param">power_t=0.5</em>, <em class="sig-param">max_iter=200</em>, <em class="sig-param">shuffle=True</em>, <em class="sig-param">random_state=None</em>, <em class="sig-param">tol=0.0001</em>, <em class="sig-param">verbose=False</em>, <em class="sig-param">warm_start=False</em>, <em class="sig-param">momentum=0.9</em>, <em class="sig-param">nesterovs_momentum=True</em>, <em class="sig-param">early_stopping=False</em>, <em class="sig-param">validation_fraction=0.1</em>, <em class="sig-param">beta_1=0.9</em>, <em class="sig-param">beta_2=0.999</em>, <em class="sig-param">epsilon=1e-08</em>, <em class="sig-param">n_iter_no_change=10</em>, <em class="sig-param">max_fun=15000</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/scikit-learn/scikit-learn/blob/5f3c3f037/sklearn/neural_network/_multilayer_perceptron.py#L1083"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#sklearn.neural_network.MLPRegressor" title="Permalink to this definition">¶</a></dt>
<dd><p>Multi-layer Perceptron regressor.</p>
<p>This model optimizes the squared-loss using LBFGS or stochastic gradient
descent.</p>
<div class="versionadded">
<p><span class="versionmodified added">New in version 0.18.</span></p>
</div>
<dl class="field-list">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><dl>
<dt><strong>hidden_layer_sizes</strong><span class="classifier">tuple, length = n_layers - 2, default (100,)</span></dt><dd><p>The ith element represents the number of neurons in the ith
hidden layer.</p>
</dd>
<dt><strong>activation</strong><span class="classifier">{‘identity’, ‘logistic’, ‘tanh’, ‘relu’}, default ‘relu’</span></dt><dd><p>Activation function for the hidden layer.</p>
<ul class="simple">
<li><p>‘identity’, no-op activation, useful to implement linear bottleneck,
returns f(x) = x</p></li>
<li><p>‘logistic’, the logistic sigmoid function,
returns f(x) = 1 / (1 + exp(-x)).</p></li>
<li><p>‘tanh’, the hyperbolic tan function,
returns f(x) = tanh(x).</p></li>
<li><p>‘relu’, the rectified linear unit function,
returns f(x) = max(0, x)</p></li>
</ul>
</dd>
<dt><strong>solver</strong><span class="classifier">{‘lbfgs’, ‘sgd’, ‘adam’}, default ‘adam’</span></dt><dd><p>The solver for weight optimization.</p>
<ul class="simple">
<li><p>‘lbfgs’ is an optimizer in the family of quasi-Newton methods.</p></li>
<li><p>‘sgd’ refers to stochastic gradient descent.</p></li>
<li><p>‘adam’ refers to a stochastic gradient-based optimizer proposed by
Kingma, Diederik, and Jimmy Ba</p></li>
</ul>
<p>Note: The default solver ‘adam’ works pretty well on relatively
large datasets (with thousands of training samples or more) in terms of
both training time and validation score.
For small datasets, however, ‘lbfgs’ can converge faster and perform
better.</p>
</dd>
<dt><strong>alpha</strong><span class="classifier">float, optional, default 0.0001</span></dt><dd><p>L2 penalty (regularization term) parameter.</p>
</dd>
<dt><strong>batch_size</strong><span class="classifier">int, optional, default ‘auto’</span></dt><dd><p>Size of minibatches for stochastic optimizers.
If the solver is ‘lbfgs’, the classifier will not use minibatch.
When set to “auto”, <code class="docutils literal notranslate"><span class="pre">batch_size=min(200,</span> <span class="pre">n_samples)</span></code></p>
</dd>
<dt><strong>learning_rate</strong><span class="classifier">{‘constant’, ‘invscaling’, ‘adaptive’}, default ‘constant’</span></dt><dd><p>Learning rate schedule for weight updates.</p>
<ul class="simple">
<li><p>‘constant’ is a constant learning rate given by
‘learning_rate_init’.</p></li>
<li><p>‘invscaling’ gradually decreases the learning rate <code class="docutils literal notranslate"><span class="pre">learning_rate_</span></code>
at each time step ‘t’ using an inverse scaling exponent of ‘power_t’.
effective_learning_rate = learning_rate_init / pow(t, power_t)</p></li>
<li><p>‘adaptive’ keeps the learning rate constant to
‘learning_rate_init’ as long as training loss keeps decreasing.
Each time two consecutive epochs fail to decrease training loss by at
least tol, or fail to increase validation score by at least tol if
‘early_stopping’ is on, the current learning rate is divided by 5.</p></li>
</ul>
<p>Only used when solver=’sgd’.</p>
</dd>
<dt><strong>learning_rate_init</strong><span class="classifier">double, optional, default 0.001</span></dt><dd><p>The initial learning rate used. It controls the step-size
in updating the weights. Only used when solver=’sgd’ or ‘adam’.</p>
</dd>
<dt><strong>power_t</strong><span class="classifier">double, optional, default 0.5</span></dt><dd><p>The exponent for inverse scaling learning rate.
It is used in updating effective learning rate when the learning_rate
is set to ‘invscaling’. Only used when solver=’sgd’.</p>
</dd>
<dt><strong>max_iter</strong><span class="classifier">int, optional, default 200</span></dt><dd><p>Maximum number of iterations. The solver iterates until convergence
(determined by ‘tol’) or this number of iterations. For stochastic
solvers (‘sgd’, ‘adam’), note that this determines the number of epochs
(how many times each data point will be used), not the number of
gradient steps.</p>
</dd>
<dt><strong>shuffle</strong><span class="classifier">bool, optional, default True</span></dt><dd><p>Whether to shuffle samples in each iteration. Only used when
solver=’sgd’ or ‘adam’.</p>
</dd>
<dt><strong>random_state</strong><span class="classifier">int, RandomState instance or None, optional, default None</span></dt><dd><p>If int, random_state is the seed used by the random number generator;
If RandomState instance, random_state is the random number generator;
If None, the random number generator is the RandomState instance used
by <code class="docutils literal notranslate"><span class="pre">np.random</span></code>.</p>
</dd>
<dt><strong>tol</strong><span class="classifier">float, optional, default 1e-4</span></dt><dd><p>Tolerance for the optimization. When the loss or score is not improving
by at least <code class="docutils literal notranslate"><span class="pre">tol</span></code> for <code class="docutils literal notranslate"><span class="pre">n_iter_no_change</span></code> consecutive iterations,
unless <code class="docutils literal notranslate"><span class="pre">learning_rate</span></code> is set to ‘adaptive’, convergence is
considered to be reached and training stops.</p>
</dd>
<dt><strong>verbose</strong><span class="classifier">bool, optional, default False</span></dt><dd><p>Whether to print progress messages to stdout.</p>
</dd>
<dt><strong>warm_start</strong><span class="classifier">bool, optional, default False</span></dt><dd><p>When set to True, reuse the solution of the previous
call to fit as initialization, otherwise, just erase the
previous solution. See <a class="reference internal" href="../../glossary.html#term-warm-start"><span class="xref std std-term">the Glossary</span></a>.</p>
</dd>
<dt><strong>momentum</strong><span class="classifier">float, default 0.9</span></dt><dd><p>Momentum for gradient descent update.  Should be between 0 and 1. Only
used when solver=’sgd’.</p>
</dd>
<dt><strong>nesterovs_momentum</strong><span class="classifier">boolean, default True</span></dt><dd><p>Whether to use Nesterov’s momentum. Only used when solver=’sgd’ and
momentum &gt; 0.</p>
</dd>
<dt><strong>early_stopping</strong><span class="classifier">bool, default False</span></dt><dd><p>Whether to use early stopping to terminate training when validation
score is not improving. If set to true, it will automatically set
aside 10% of training data as validation and terminate training when
validation score is not improving by at least <code class="docutils literal notranslate"><span class="pre">tol</span></code> for
<code class="docutils literal notranslate"><span class="pre">n_iter_no_change</span></code> consecutive epochs.
Only effective when solver=’sgd’ or ‘adam’</p>
</dd>
<dt><strong>validation_fraction</strong><span class="classifier">float, optional, default 0.1</span></dt><dd><p>The proportion of training data to set aside as validation set for
early stopping. Must be between 0 and 1.
Only used if early_stopping is True</p>
</dd>
<dt><strong>beta_1</strong><span class="classifier">float, optional, default 0.9</span></dt><dd><p>Exponential decay rate for estimates of first moment vector in adam,
should be in [0, 1). Only used when solver=’adam’</p>
</dd>
<dt><strong>beta_2</strong><span class="classifier">float, optional, default 0.999</span></dt><dd><p>Exponential decay rate for estimates of second moment vector in adam,
should be in [0, 1). Only used when solver=’adam’</p>
</dd>
<dt><strong>epsilon</strong><span class="classifier">float, optional, default 1e-8</span></dt><dd><p>Value for numerical stability in adam. Only used when solver=’adam’</p>
</dd>
<dt><strong>n_iter_no_change</strong><span class="classifier">int, optional, default 10</span></dt><dd><p>Maximum number of epochs to not meet <code class="docutils literal notranslate"><span class="pre">tol</span></code> improvement.
Only effective when solver=’sgd’ or ‘adam’</p>
<div class="versionadded">
<p><span class="versionmodified added">New in version 0.20.</span></p>
</div>
</dd>
<dt><strong>max_fun</strong><span class="classifier">int, optional, default 15000</span></dt><dd><p>Only used when solver=’lbfgs’. Maximum number of function calls.
The solver iterates until convergence (determined by ‘tol’), number
of iterations reaches max_iter, or this number of function calls.
Note that number of function calls will be greater than or equal to
the number of iterations for the MLPRegressor.</p>
<div class="versionadded">
<p><span class="versionmodified added">New in version 0.22.</span></p>
</div>
</dd>
</dl>
</dd>
<dt class="field-even">Attributes</dt>
<dd class="field-even"><dl class="simple">
<dt><strong>loss_</strong><span class="classifier">float</span></dt><dd><p>The current loss computed with the loss function.</p>
</dd>
<dt><strong>coefs_</strong><span class="classifier">list, length n_layers - 1</span></dt><dd><p>The ith element in the list represents the weight matrix corresponding
to layer i.</p>
</dd>
<dt><strong>intercepts_</strong><span class="classifier">list, length n_layers - 1</span></dt><dd><p>The ith element in the list represents the bias vector corresponding to
layer i + 1.</p>
</dd>
<dt><strong>n_iter_</strong><span class="classifier">int,</span></dt><dd><p>The number of iterations the solver has ran.</p>
</dd>
<dt><strong>n_layers_</strong><span class="classifier">int</span></dt><dd><p>Number of layers.</p>
</dd>
<dt><strong>n_outputs_</strong><span class="classifier">int</span></dt><dd><p>Number of outputs.</p>
</dd>
<dt><strong>out_activation_</strong><span class="classifier">string</span></dt><dd><p>Name of the output activation function.</p>
</dd>
</dl>
</dd>
</dl>
<p class="rubric">Notes</p>
<p>MLPRegressor trains iteratively since at each time step
the partial derivatives of the loss function with respect to the model
parameters are computed to update the parameters.</p>
<p>It can also have a regularization term added to the loss function
that shrinks model parameters to prevent overfitting.</p>
<p>This implementation works with data represented as dense and sparse numpy
arrays of floating point values.</p>
<p class="rubric">References</p>
<dl class="simple">
<dt>Hinton, Geoffrey E.</dt><dd><p>“Connectionist learning procedures.” Artificial intelligence 40.1
(1989): 185-234.</p>
</dd>
<dt>Glorot, Xavier, and Yoshua Bengio. “Understanding the difficulty of</dt><dd><p>training deep feedforward neural networks.” International Conference
on Artificial Intelligence and Statistics. 2010.</p>
</dd>
<dt>He, Kaiming, et al. “Delving deep into rectifiers: Surpassing human-level</dt><dd><p>performance on imagenet classification.” arXiv preprint
arXiv:1502.01852 (2015).</p>
</dd>
<dt>Kingma, Diederik, and Jimmy Ba. “Adam: A method for stochastic</dt><dd><p>optimization.” arXiv preprint arXiv:1412.6980 (2014).</p>
</dd>
</dl>
<p class="rubric">Methods</p>
<table class="longtable docutils align-default">
<colgroup>
<col style="width: 10%" />
<col style="width: 90%" />
</colgroup>
<tbody>
<tr class="row-odd"><td><p><a class="reference internal" href="#sklearn.neural_network.MLPRegressor.fit" title="sklearn.neural_network.MLPRegressor.fit"><code class="xref py py-obj docutils literal notranslate"><span class="pre">fit</span></code></a>(self, X, y)</p></td>
<td><p>Fit the model to data matrix X and target(s) y.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#sklearn.neural_network.MLPRegressor.get_params" title="sklearn.neural_network.MLPRegressor.get_params"><code class="xref py py-obj docutils literal notranslate"><span class="pre">get_params</span></code></a>(self[, deep])</p></td>
<td><p>Get parameters for this estimator.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#sklearn.neural_network.MLPRegressor.predict" title="sklearn.neural_network.MLPRegressor.predict"><code class="xref py py-obj docutils literal notranslate"><span class="pre">predict</span></code></a>(self, X)</p></td>
<td><p>Predict using the multi-layer perceptron model.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#sklearn.neural_network.MLPRegressor.score" title="sklearn.neural_network.MLPRegressor.score"><code class="xref py py-obj docutils literal notranslate"><span class="pre">score</span></code></a>(self, X, y[, sample_weight])</p></td>
<td><p>Return the coefficient of determination R^2 of the prediction.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#sklearn.neural_network.MLPRegressor.set_params" title="sklearn.neural_network.MLPRegressor.set_params"><code class="xref py py-obj docutils literal notranslate"><span class="pre">set_params</span></code></a>(self, \*\*params)</p></td>
<td><p>Set the parameters of this estimator.</p></td>
</tr>
</tbody>
</table>
<dl class="method">
<dt id="sklearn.neural_network.MLPRegressor.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">hidden_layer_sizes=(100</em>, <em class="sig-param">)</em>, <em class="sig-param">activation='relu'</em>, <em class="sig-param">solver='adam'</em>, <em class="sig-param">alpha=0.0001</em>, <em class="sig-param">batch_size='auto'</em>, <em class="sig-param">learning_rate='constant'</em>, <em class="sig-param">learning_rate_init=0.001</em>, <em class="sig-param">power_t=0.5</em>, <em class="sig-param">max_iter=200</em>, <em class="sig-param">shuffle=True</em>, <em class="sig-param">random_state=None</em>, <em class="sig-param">tol=0.0001</em>, <em class="sig-param">verbose=False</em>, <em class="sig-param">warm_start=False</em>, <em class="sig-param">momentum=0.9</em>, <em class="sig-param">nesterovs_momentum=True</em>, <em class="sig-param">early_stopping=False</em>, <em class="sig-param">validation_fraction=0.1</em>, <em class="sig-param">beta_1=0.9</em>, <em class="sig-param">beta_2=0.999</em>, <em class="sig-param">epsilon=1e-08</em>, <em class="sig-param">n_iter_no_change=10</em>, <em class="sig-param">max_fun=15000</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/scikit-learn/scikit-learn/blob/5f3c3f037/sklearn/neural_network/_multilayer_perceptron.py#L1295"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#sklearn.neural_network.MLPRegressor.__init__" title="Permalink to this definition">¶</a></dt>
<dd><p>Initialize self.  See help(type(self)) for accurate signature.</p>
</dd></dl>

<dl class="method">
<dt id="sklearn.neural_network.MLPRegressor.fit">
<code class="sig-name descname">fit</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">X</em>, <em class="sig-param">y</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/scikit-learn/scikit-learn/blob/5f3c3f037/sklearn/neural_network/_multilayer_perceptron.py#L611"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#sklearn.neural_network.MLPRegressor.fit" title="Permalink to this definition">¶</a></dt>
<dd><p>Fit the model to data matrix X and target(s) y.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><dl class="simple">
<dt><strong>X</strong><span class="classifier">array-like or sparse matrix, shape (n_samples, n_features)</span></dt><dd><p>The input data.</p>
</dd>
<dt><strong>y</strong><span class="classifier">array-like, shape (n_samples,) or (n_samples, n_outputs)</span></dt><dd><p>The target values (class labels in classification, real numbers in
regression).</p>
</dd>
</dl>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><dl class="simple">
<dt><strong>self</strong><span class="classifier">returns a trained MLP model.</span></dt><dd></dd>
</dl>
</dd>
</dl>
</dd></dl>

<dl class="method">
<dt id="sklearn.neural_network.MLPRegressor.get_params">
<code class="sig-name descname">get_params</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">deep=True</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/scikit-learn/scikit-learn/blob/5f3c3f037/sklearn/base.py#L173"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#sklearn.neural_network.MLPRegressor.get_params" title="Permalink to this definition">¶</a></dt>
<dd><p>Get parameters for this estimator.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><dl class="simple">
<dt><strong>deep</strong><span class="classifier">bool, default=True</span></dt><dd><p>If True, will return the parameters for this estimator and
contained subobjects that are estimators.</p>
</dd>
</dl>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><dl class="simple">
<dt><strong>params</strong><span class="classifier">mapping of string to any</span></dt><dd><p>Parameter names mapped to their values.</p>
</dd>
</dl>
</dd>
</dl>
</dd></dl>

<dl class="method">
<dt id="sklearn.neural_network.MLPRegressor.partial_fit">
<em class="property">property </em><code class="sig-name descname">partial_fit</code><a class="headerlink" href="#sklearn.neural_network.MLPRegressor.partial_fit" title="Permalink to this definition">¶</a></dt>
<dd><p>Update the model with a single iteration over the given data.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><dl class="simple">
<dt><strong>X</strong><span class="classifier">{array-like, sparse matrix}, shape (n_samples, n_features)</span></dt><dd><p>The input data.</p>
</dd>
<dt><strong>y</strong><span class="classifier">array-like, shape (n_samples,)</span></dt><dd><p>The target values.</p>
</dd>
</dl>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><dl class="simple">
<dt><strong>self</strong><span class="classifier">returns a trained MLP model.</span></dt><dd></dd>
</dl>
</dd>
</dl>
</dd></dl>

<dl class="method">
<dt id="sklearn.neural_network.MLPRegressor.predict">
<code class="sig-name descname">predict</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">X</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/scikit-learn/scikit-learn/blob/5f3c3f037/sklearn/neural_network/_multilayer_perceptron.py#L1319"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#sklearn.neural_network.MLPRegressor.predict" title="Permalink to this definition">¶</a></dt>
<dd><p>Predict using the multi-layer perceptron model.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><dl class="simple">
<dt><strong>X</strong><span class="classifier">{array-like, sparse matrix}, shape (n_samples, n_features)</span></dt><dd><p>The input data.</p>
</dd>
</dl>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><dl class="simple">
<dt><strong>y</strong><span class="classifier">array-like, shape (n_samples, n_outputs)</span></dt><dd><p>The predicted values.</p>
</dd>
</dl>
</dd>
</dl>
</dd></dl>

<dl class="method">
<dt id="sklearn.neural_network.MLPRegressor.score">
<code class="sig-name descname">score</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">X</em>, <em class="sig-param">y</em>, <em class="sig-param">sample_weight=None</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/scikit-learn/scikit-learn/blob/5f3c3f037/sklearn/base.py#L376"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#sklearn.neural_network.MLPRegressor.score" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the coefficient of determination R^2 of the prediction.</p>
<p>The coefficient R^2 is defined as (1 - u/v), where u is the residual
sum of squares ((y_true - y_pred) ** 2).sum() and v is the total
sum of squares ((y_true - y_true.mean()) ** 2).sum().
The best possible score is 1.0 and it can be negative (because the
model can be arbitrarily worse). A constant model that always
predicts the expected value of y, disregarding the input features,
would get a R^2 score of 0.0.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><dl class="simple">
<dt><strong>X</strong><span class="classifier">array-like of shape (n_samples, n_features)</span></dt><dd><p>Test samples. For some estimators this may be a
precomputed kernel matrix or a list of generic objects instead,
shape = (n_samples, n_samples_fitted),
where n_samples_fitted is the number of
samples used in the fitting for the estimator.</p>
</dd>
<dt><strong>y</strong><span class="classifier">array-like of shape (n_samples,) or (n_samples, n_outputs)</span></dt><dd><p>True values for X.</p>
</dd>
<dt><strong>sample_weight</strong><span class="classifier">array-like of shape (n_samples,), default=None</span></dt><dd><p>Sample weights.</p>
</dd>
</dl>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><dl class="simple">
<dt><strong>score</strong><span class="classifier">float</span></dt><dd><p>R^2 of self.predict(X) wrt. y.</p>
</dd>
</dl>
</dd>
</dl>
<p class="rubric">Notes</p>
<p>The R2 score used when calling <code class="docutils literal notranslate"><span class="pre">score</span></code> on a regressor will use
<code class="docutils literal notranslate"><span class="pre">multioutput='uniform_average'</span></code> from version 0.23 to keep consistent
with <a class="reference internal" href="sklearn.metrics.r2_score.html#sklearn.metrics.r2_score" title="sklearn.metrics.r2_score"><code class="xref py py-func docutils literal notranslate"><span class="pre">r2_score</span></code></a>. This will influence the
<code class="docutils literal notranslate"><span class="pre">score</span></code> method of all the multioutput regressors (except for
<a class="reference internal" href="sklearn.multioutput.MultiOutputRegressor.html#sklearn.multioutput.MultiOutputRegressor" title="sklearn.multioutput.MultiOutputRegressor"><code class="xref py py-class docutils literal notranslate"><span class="pre">MultiOutputRegressor</span></code></a>). To specify the
default value manually and avoid the warning, please either call
<a class="reference internal" href="sklearn.metrics.r2_score.html#sklearn.metrics.r2_score" title="sklearn.metrics.r2_score"><code class="xref py py-func docutils literal notranslate"><span class="pre">r2_score</span></code></a> directly or make a custom scorer with
<a class="reference internal" href="sklearn.metrics.make_scorer.html#sklearn.metrics.make_scorer" title="sklearn.metrics.make_scorer"><code class="xref py py-func docutils literal notranslate"><span class="pre">make_scorer</span></code></a> (the built-in scorer <code class="docutils literal notranslate"><span class="pre">'r2'</span></code> uses
<code class="docutils literal notranslate"><span class="pre">multioutput='uniform_average'</span></code>).</p>
</dd></dl>

<dl class="method">
<dt id="sklearn.neural_network.MLPRegressor.set_params">
<code class="sig-name descname">set_params</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">**params</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/scikit-learn/scikit-learn/blob/5f3c3f037/sklearn/base.py#L205"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#sklearn.neural_network.MLPRegressor.set_params" title="Permalink to this definition">¶</a></dt>
<dd><p>Set the parameters of this estimator.</p>
<p>The method works on simple estimators as well as on nested objects
(such as pipelines). The latter have parameters of the form
<code class="docutils literal notranslate"><span class="pre">&lt;component&gt;__&lt;parameter&gt;</span></code> so that it’s possible to update each
component of a nested object.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><dl class="simple">
<dt><strong>**params</strong><span class="classifier">dict</span></dt><dd><p>Estimator parameters.</p>
</dd>
</dl>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><dl class="simple">
<dt><strong>self</strong><span class="classifier">object</span></dt><dd><p>Estimator instance.</p>
</dd>
</dl>
</dd>
</dl>
</dd></dl>

</dd></dl>

<div class="section" id="examples-using-sklearn-neural-network-mlpregressor">
<h2>Examples using <code class="docutils literal notranslate"><span class="pre">sklearn.neural_network.MLPRegressor</span></code><a class="headerlink" href="#examples-using-sklearn-neural-network-mlpregressor" title="Permalink to this headline">¶</a></h2>
<div class="sphx-glr-thumbcontainer" tooltip="    See also sphx_glr_auto_examples_plot_roc_curve_visualization_api.py"><div class="figure align-default" id="id1">
<img alt="../../_images/sphx_glr_plot_partial_dependence_visualization_api_thumb.png" src="../../_images/sphx_glr_plot_partial_dependence_visualization_api_thumb.png" />
<p class="caption"><span class="caption-text"><a class="reference internal" href="../../auto_examples/plot_partial_dependence_visualization_api.html#sphx-glr-auto-examples-plot-partial-dependence-visualization-api-py"><span class="std std-ref">Advanced Plotting With Partial Dependence</span></a></span><a class="headerlink" href="#id1" title="Permalink to this image">¶</a></p>
</div>
</div><div class="sphx-glr-thumbcontainer" tooltip="Partial dependence plots show the dependence between the target function [2]_ and a set of &#x27;tar..."><div class="figure align-default" id="id2">
<img alt="../../_images/sphx_glr_plot_partial_dependence_thumb.png" src="../../_images/sphx_glr_plot_partial_dependence_thumb.png" />
<p class="caption"><span class="caption-text"><a class="reference internal" href="../../auto_examples/inspection/plot_partial_dependence.html#sphx-glr-auto-examples-inspection-plot-partial-dependence-py"><span class="std std-ref">Partial Dependence Plots</span></a></span><a class="headerlink" href="#id2" title="Permalink to this image">¶</a></p>
</div>
</div><div class="clearer"></div></div>
</div>


      </div>
    <div class="container">
      <footer class="sk-content-footer">
            &copy; 2007 - 2019, scikit-learn developers (BSD License).
          <a href="../../_sources/modules/generated/sklearn.neural_network.MLPRegressor.rst.txt" rel="nofollow">Show this page source</a>
      </footer>
    </div>
  </div>
</div>
<script src="../../_static/js/vendor/bootstrap.min.js"></script>

<script>
    window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
    ga('create', 'UA-22606712-2', 'auto');
    ga('set', 'anonymizeIp', true);
    ga('send', 'pageview');
</script>
<script async src='https://www.google-analytics.com/analytics.js'></script>


<script>
$(document).ready(function() {
    /* Add a [>>>] button on the top-right corner of code samples to hide
     * the >>> and ... prompts and the output and thus make the code
     * copyable. */
    var div = $('.highlight-python .highlight,' +
                '.highlight-python3 .highlight,' +
                '.highlight-pycon .highlight,' +
		'.highlight-default .highlight')
    var pre = div.find('pre');

    // get the styles from the current theme
    pre.parent().parent().css('position', 'relative');
    var hide_text = 'Hide prompts and outputs';
    var show_text = 'Show prompts and outputs';

    // create and add the button to all the code blocks that contain >>>
    div.each(function(index) {
        var jthis = $(this);
        if (jthis.find('.gp').length > 0) {
            var button = $('<span class="copybutton">&gt;&gt;&gt;</span>');
            button.attr('title', hide_text);
            button.data('hidden', 'false');
            jthis.prepend(button);
        }
        // tracebacks (.gt) contain bare text elements that need to be
        // wrapped in a span to work with .nextUntil() (see later)
        jthis.find('pre:has(.gt)').contents().filter(function() {
            return ((this.nodeType == 3) && (this.data.trim().length > 0));
        }).wrap('<span>');
    });

    // define the behavior of the button when it's clicked
    $('.copybutton').click(function(e){
        e.preventDefault();
        var button = $(this);
        if (button.data('hidden') === 'false') {
            // hide the code output
            button.parent().find('.go, .gp, .gt').hide();
            button.next('pre').find('.gt').nextUntil('.gp, .go').css('visibility', 'hidden');
            button.css('text-decoration', 'line-through');
            button.attr('title', show_text);
            button.data('hidden', 'true');
        } else {
            // show the code output
            button.parent().find('.go, .gp, .gt').show();
            button.next('pre').find('.gt').nextUntil('.gp, .go').css('visibility', 'visible');
            button.css('text-decoration', 'none');
            button.attr('title', hide_text);
            button.data('hidden', 'false');
        }
    });

	/*** Add permalink buttons next to glossary terms ***/
	$('dl.glossary > dt[id]').append(function() {
		return ('<a class="headerlink" href="#' +
			    this.getAttribute('id') +
			    '" title="Permalink to this term">¶</a>');
	});
  /*** Hide navbar when scrolling down ***/
  // Returns true when headerlink target matches hash in url
  (function() {
    hashTargetOnTop = function() {
        var hash = window.location.hash;
        if ( hash.length < 2 ) { return false; }

        var target = document.getElementById( hash.slice(1) );
        if ( target === null ) { return false; }

        var top = target.getBoundingClientRect().top;
        return (top < 2) && (top > -2);
    };

    // Hide navbar on load if hash target is on top
    var navBar = document.getElementById("navbar");
    var navBarToggler = document.getElementById("sk-navbar-toggler");
    var navBarHeightHidden = "-" + navBar.getBoundingClientRect().height + "px";
    var $window = $(window);

    hideNavBar = function() {
        navBar.style.top = navBarHeightHidden;
    };

    showNavBar = function() {
        navBar.style.top = "0";
    }

    if (hashTargetOnTop()) {
        hideNavBar()
    }

    var prevScrollpos = window.pageYOffset;
    hideOnScroll = function(lastScrollTop) {
        if (($window.width() < 768) && (navBarToggler.getAttribute("aria-expanded") === 'true')) {
            return;
        }
        if (lastScrollTop > 2 && (prevScrollpos <= lastScrollTop) || hashTargetOnTop()){
            hideNavBar()
        } else {
            showNavBar()
        }
        prevScrollpos = lastScrollTop;
    };

    /*** high preformance scroll event listener***/
    var raf = window.requestAnimationFrame ||
        window.webkitRequestAnimationFrame ||
        window.mozRequestAnimationFrame ||
        window.msRequestAnimationFrame ||
        window.oRequestAnimationFrame;
    var lastScrollTop = $window.scrollTop();

    if (raf) {
        loop();
    }

    function loop() {
        var scrollTop = $window.scrollTop();
        if (lastScrollTop === scrollTop) {
            raf(loop);
            return;
        } else {
            lastScrollTop = scrollTop;
            hideOnScroll(lastScrollTop);
            raf(loop);
        }
    }
  })();
});

</script>
    
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js"></script>
    
</body>
</html>